﻿Imports FixSoft.Fixed.Forms
Imports System.Runtime.InteropServices

Public Class Test2

    Public Overrides Sub ResetAeroBackground()
        ExcludeControlFromAero(Panel3, , False)
        SetAeroBlur(Panel2)
    End Sub

    Private Sub Test2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.CaptionBarRenderMode = CaptionBarStates.Active
        AeroTransparentyEnabled = True
        BackgroundControl = CreateArray(Of Control)(Panel4)
        Me.TextRenderMode = RenderMode.Parent
        Label4.Parent = Button1
        HideLabel(Label2)
        HideLabel(Label5)
        AddAeroMovableControl(Panel1)
        AddAeroMovableControl(Panel2)
        AddAeroMovableControl(Panel3)
        AddAeroMovableControl(Panel4)
        AddAeroMovableControl(Panel6)
    End Sub

    Private Sub Panel4_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Panel4.Paint
        e.Graphics.FillRectangle(Brushes.Green, New Rectangle(10, 12, 30, 40))
        Dim label As Label = Label2
        Dim LabelAlign As TextFormatFlags
        Select Case label.TextAlign
            Case Drawing.ContentAlignment.BottomCenter
                LabelAlign = TextFormatFlags.Bottom Or TextFormatFlags.HorizontalCenter
            Case Drawing.ContentAlignment.BottomLeft
                LabelAlign = TextFormatFlags.Bottom Or TextFormatFlags.Left
            Case Drawing.ContentAlignment.BottomRight
                LabelAlign = TextFormatFlags.Bottom Or TextFormatFlags.Right
            Case Drawing.ContentAlignment.MiddleCenter
                LabelAlign = TextFormatFlags.VerticalCenter Or TextFormatFlags.HorizontalCenter
            Case Drawing.ContentAlignment.MiddleLeft
                LabelAlign = TextFormatFlags.VerticalCenter Or TextFormatFlags.Left
            Case Drawing.ContentAlignment.MiddleRight
                LabelAlign = TextFormatFlags.VerticalCenter Or TextFormatFlags.Right
            Case Drawing.ContentAlignment.TopCenter
                LabelAlign = TextFormatFlags.Top Or TextFormatFlags.HorizontalCenter
            Case Drawing.ContentAlignment.TopLeft
                LabelAlign = TextFormatFlags.Top Or TextFormatFlags.Left
            Case Drawing.ContentAlignment.TopRight
                LabelAlign = TextFormatFlags.Top Or TextFormatFlags.Right
        End Select
        If label.Text.Contains(vbNewLine) = False Then
            LabelAlign = LabelAlign Or TextFormatFlags.SingleLine
        End If
        If label.RightToLeft = Windows.Forms.RightToLeft.Yes Then
            LabelAlign = LabelAlign Or TextFormatFlags.RightToLeft
        End If
        label.Visible = False
        Dim t As Rectangle = label.Bounds
        t.Height += 20
        t.Width += 10
        If AeroEnabled Then
            e.Graphics.SetClip(t)
            e.Graphics.Clear(Panel4.BackColor)
            e.Graphics.SetClip(sender.CreateGraphics)
        End If
        DrawGlowTextWithTransparenty(e.Graphics, label.Text, label.Font, t, label.ForeColor, LabelAlign Or TextFormatFlags.NoPrefix, GlowValue)
        '  DrawTextGlow(Label.Parent.CreateGraphics, Label.Text, Label.Font, Label.Bounds, Label.ForeColor, LabelAlign Or TextFormatFlags.NoPrefix, GlowValue)
        'Using TLabel As Control = CommonTools.GetActualLocationAsControl(Label)
        '   DrawTextGlow(e.Graphics, Label.Text, Label.Font, TLabel.Bounds, Label.ForeColor, LabelAlign Or TextFormatFlags.NoPrefix, GlowValue)
        'End Using
    End Sub

    Private Sub Test2_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint

    End Sub
End Class

